﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace MicroMq.Helper
{
    public class DefaultComparer<T, KEY> : IComparer<T>
    {
        private readonly Func<T, KEY> func;
        public DefaultComparer(Func<T, KEY> func)
        {
            this.func = func;
        }

        public int Compare(T x, T y)
        {
            return Comparer.Default.Compare(func(x), func(y));
        }
    }
}
